

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="__STATIC__/layuiadmin/layui/css/layui.css" media="all">
</head>
<body>

<div class="layui-form" lay-filter="layuiadmin-form-role" id="layuiadmin-form-role" style="padding: 20px 30px 0 0;">

    <div class="layui-form-item">
        <label class="layui-form-label">用户名</label>
        <div class="layui-input-inline">
            <input type="text" name="username" lay-verify="required" autocomplete="off" class="layui-input" value="{$data.username}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-inline">
            <input type="text" name="password" lay-verify="required" autocomplete="off" class="layui-input" value="{$data.password}">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">选择角色</label>
        <div class="layui-input-inline">
            <select name="role_id">
                {:widget('common/common/getUserRoleSelect',['default'=>$data.role_id])}
            </select>
        </div>
    </div>

    <input type="hidden" name="id" value="{$data.id}">
    <div class="layui-form-item">
        <div class="layui-input-block">
            <button class="layui-btn" lay-submit lay-filter="*">提交</button>
        </div>

    </div>
</div>

<script src="__STATIC__/layuiadmin/layui/layui.js"></script>
<script src="__STATIC__/js/base.js"></script>
<script>
    layui.use(['form','layer'], function () {
        var form = layui.form
            ,$ = layui.jquery
            ,layer = layui.layer;


        form.on("submit(*)",function(data){
            $.post("{:url('user/userSave')}",data.field,function(ret){
                if(ret.code == 0){
                    layer.msg(ret.msg,{time:1500,icon:6},function () {
                        parent.layer.closeAll();
                        parent.layui.table.reload("KT_table")
                    });

                }else{
                    layer.msg(ret.msg,{time:1500,icon:5});
                }
            });
            return false;
        })


    })
</script>
</body>
</html>